/**
    @project {
        "templateId": "org.helgoboss.custom",
        "version": "0.1-SNAPSHOT",
        "dependencies": [
            "org.scala-lang:scala-library:2.9.0-1",
            "org.helgoboss:scala-additions:0.1-SNAPSHOT",
            "org.helgoboss:mini-obr-runtime-ref-impl:0.1-SNAPSHOT",
            "org.helgoboss:obr-facade-api:0.3-SNAPSHOT",
            "org.helgoboss:osgi-additions:0.1-SNAPSHOT",
            "org.helgoboss:commandlet-api:0.1-SNAPSHOT",
            "org.helgoboss:commandlet-convenience:0.1-SNAPSHOT"
        ],
        "commandletId": "org.helgoboss.mini-obr-runtime"
    }
*/
package org.helgoboss.mini_obr_runtime_commandlet

import org.helgoboss.mini_obr_runtime_ref_impl._
import org.helgoboss.obr_facade.ResourceId
import org.helgoboss.commandlet._
import org.helgoboss.osgi_additions._

class Activator extends OsgiProvider with OsgiServiceWatcher {
    whenBundleActive {
        (new MiniObrRuntimeCommandlet).providesService[Commandlet]
    }
}

import java.io.File
import java.net.URL

class MiniObrRuntimeCommandlet extends Commandlet {
    val id = "org.helgoboss.mini-obr-runtime"

    def execute(context: ExecutionContext) = {
        val miniObrRuntime = new MiniObrRuntimeRefImpl (
            userHomeDir = new File("C:/Temp/mini-obr"),
            repositories = List (
                new URL("file:/C:/Dokumente%20und%20Einstellungen/helgoboss/.m2/repository/repository.xml")
            ),
            resources = List (
                ResourceId("org.ops4j.pax.logging.pax-logging-service", "1.6.3"),
                ResourceId("org.helgoboss.common-one-filer-templates-activator", "0.1.0.SNAPSHOT"),
                ResourceId("org.helgoboss.one-filer-ref-impl-activator", "0.1.0.SNAPSHOT"),
                ResourceId("org.helgoboss.commandlet-manager-ref-impl", "0.1.0.SNAPSHOT"),
                ResourceId("org.helgoboss.one-filer-commandlet", "0.2.0.SNAPSHOT")
            ),
            commandletId = Some("org.helgoboss.one-filer"),
            commandletExecutionContext = context
        )
        miniObrRuntime.start
    }
}